home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Games / InputSprocketTest / InputSprocketSimpleTest.r < prev    next >
Encoding:
Text File  |  2000-09-28  |  5.9 KB  |  191 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        InputSprocketSimpleTest.r
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     File Ownership:
  11.  
  12.         DRI:                xxx put dri here xxx
  13.  
  14.         Other Contact:        xxx put other contact here xxx
  15.  
  16.         Technology:            xxx put technology here xxx
  17.  
  18.     Writers:
  19.  
  20.         (BWS)    Brent Schorsch
  21.  
  22.     Change History (most recent first):
  23.  
  24.          <1>     7/17/98    BWS        first checked in
  25. */
  26.  
  27. /*************************************************************************************
  28.  
  29. File:      InputSprocketSimpleTest.r
  30.  
  31. Copyright © 1996, 1997, 1998 Apple Computer, Inc., All Rights Reserved
  32.  
  33.  
  34. You may incorporate this sample code into your applications without
  35. restriction, though the sample code has been provided "AS IS" and the
  36. responsibility for its operation is 100% yours.  However, what you are
  37. not permitted to do is to redistribute the source as "DSC Sample Code"
  38. after having made changes. If you're going to re-distribute the source,
  39. we require that you make it clear in the source that the code was
  40. descended from Apple Sample Code, but that you've made changes.
  41.  
  42. *************************************************************************************/
  43.  
  44. #include "InputSprocket.r"
  45.  
  46. /* the InputSprocket application resource tells utility programs how the */
  47. /* application uses InputSprocket */
  48.  
  49. #define    kResourceID_isap                        128
  50. #define    kResourceID_setl                        128
  51. #define    kResourceID_tset_KeyboardDefaultSet        128
  52. #define    kResourceID_tset_MouseDefaultSet        256
  53. #define    kResourceID_tset_MouseAsDeltasSet        257
  54.  
  55.  
  56. resource 'isap' (kResourceID_isap)
  57. {
  58.     callsISpInit,
  59.     usesInputSprocket
  60. };
  61.  
  62. /* the set list resource contains the list of all the saved sets for devices */
  63. /* that are provided in the application's resource fork */
  64.  
  65. resource 'setl' (kResourceID_setl, "InputSprocketTest sets")
  66. {
  67.     currentVersion,
  68.     {
  69.         "Default", 0, kISpDeviceClass_Keyboard, kISpKeyboardID_Apple, notApplSet, isDefaultSet, kResourceID_tset_KeyboardDefaultSet,
  70.         
  71.         "Default", 0, kISpDeviceClass_Mouse, 'appl', notApplSet, isDefaultSet, kResourceID_tset_MouseDefaultSet,
  72.         "As Deltas", 0, kISpDeviceClass_Mouse, 'appl', isApplSet, notDefaultSet, kResourceID_tset_MouseAsDeltasSet
  73.     };
  74. };
  75.  
  76. /* the set resources actually contain the saved sets for one  */
  77.  
  78. /* Default keyboard set */
  79.  
  80. resource 'tset' (kResourceID_tset_KeyboardDefaultSet, "Default (Keyboard)")
  81. {
  82.     supportedVersion,
  83.     {    
  84.         /* Forward Thrust (z axis) need */
  85.         /* this need does not generate any items, because it has later button equivalents */
  86.         
  87.         /* Side Thrust (x axis) need */
  88.         kpd4Key,             /* min (left/down/back) */
  89.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  90.          
  91.         kpd6Key,             /* max (right/up/forward) */
  92.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  93.         
  94.         /* Vertical Thrust (y axis) need */
  95.         zKey,                 /* min (left/down/back) */
  96.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  97.          
  98.         aKey,                 /* max (right/up/forward) */
  99.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  100.         
  101.         /* Look (movement) need */
  102.         upKey,                 /* up */
  103.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  104.          
  105.         downKey,             /* down */
  106.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  107.         
  108.         leftKey,             /* left */
  109.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  110.          
  111.         rightKey,             /* right */
  112.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  113.         
  114.         /* Fire (button) need */
  115.         kpd0Key,
  116.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  117.         
  118.         /* Secondary Fire (button) need */
  119.         optionKey,
  120.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  121.         
  122.         /* Thrust Forward (button) need */
  123.         kpd8Key,
  124.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  125.         
  126.         /* Thrust Backward (button) need */
  127.         kpd5Key,
  128.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  129.         
  130.         /* Pause (button) need */
  131.         escKey,
  132.          rControlOff, rOptionOff, rShiftOff, controlOff, optionOff, shiftOff, commandOff,
  133.         
  134.         /* Scroll (dpad) need */
  135.         upKey,             /* up */
  136.          rControlOff, rOptionOff, rShiftOff, controlOn, optionOff, shiftOff, commandOff,
  137.          
  138.         downKey,             /* down */
  139.          rControlOff, rOptionOff, rShiftOff, controlOn, optionOff, shiftOff, commandOff,
  140.         
  141.         leftKey,             /* left */
  142.          rControlOff, rOptionOff, rShiftOff, controlOn, optionOff, shiftOff, commandOff,
  143.          
  144.         rightKey,             /* right */
  145.          rControlOff, rOptionOff, rShiftOff, controlOn, optionOff, shiftOff, commandOff
  146.  
  147.         /* Delta X (x delta) need */
  148.         /* this need does not generate any items, because the keyboard driver */
  149.         /* does not support delta needs */
  150.         
  151.         /* Delta Y (y delta) need */
  152.         /* this need does not generate any items, because the keyboard driver */
  153.         /* does not support delta needs */        
  154.     };
  155. };
  156.  
  157. /* Default mouse set (mapped to side thrust and forward thrust needs) */
  158. data 'tset' (kResourceID_tset_MouseDefaultSet, "Default (Mouse)")
  159. {
  160.     $"000000043F8000003F8000003F800000"
  161.     $"FFFF0001FFFF000100000004FFFF0001"
  162.     $"FFFF0001FFFF0001FFFF0001FFFF0001"
  163.     $"FFFF0001FFFF00010000000000000001"
  164.     $"0000000000000001FFFF0001FFFF0001"
  165.     $"FFFF0001000000000000000004715C20"
  166.     $"00000001000000110053000000550000"
  167.     $"0006000000000000007E0000007D0000"
  168.     $"007B0000007C00000052000000000000"
  169.     $"005B000000570000"
  170.  
  171. };
  172. /* thrusts */
  173.  
  174. /* 'as Deltas' mouse set (mapped to delta needs) */
  175. data 'tset' (kResourceID_tset_MouseAsDeltasSet, "As Deltas (Keyboard)")
  176. {
  177.     $"000000043F8000003F8000003F800000"
  178.     $"FFFF0001FFFF000100000004FFFF0001"
  179.     $"FFFF0001FFFF0001FFFF0001FFFF0001"
  180.     $"FFFF0001FFFF00010000000B0000000A"
  181.     $"0000000B0000000AFFFF0001FFFF0001"
  182.     $"FFFF0001000000000000000000000000"
  183.     $"000000000000000000000000014E014F"
  184.     $"04726370000000000000012004726F80"
  185.     $"04D2233C80C00000FFFF017C00000000"
  186.     $"0000000000000048"
  187. };
  188.  
  189.  
  190.  
  191.